<?php


class tx_zlib_viewhelper_page extends tx_zlib_abstract_viewhelper
{

	/**
	 * @var array
	 */
	private $_page;

	/**
	 *
	 *
	 * @param string $key
	 * @return string
	 */
    public function page($key)
    {
    	$page = $this->_getPage();
    	return array_key_exists($key, $page) ? $page[$key] : null;
	}

	/**
	 * @return array
	 */
	private function _getPage()
	{
		if(is_null($this->_page)) {
			$pid = $GLOBALS['TSFE']->cObj->data['uid'];
			$this->_page = $GLOBALS['TSFE']->sys_page->getPage($pid);
		}
		return $this->_page;
	}

}


if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/zlib/views/helpers/class.tx_zlib_viewhelper_page.php'])	{
	include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/zlib/views/helpers/class.tx_zlib_viewhelper_page.php']);
}
